package com.carlwang.util;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.junit.Test;

public class HibernateUtils {

	private static SessionFactory sessionFactory;
	static {
		Configuration config = new Configuration().configure();
		sessionFactory = config.buildSessionFactory();
	}

	public static SessionFactory getConnectionFactory() {
		return sessionFactory;
	}

	public static void shutDown() {
		sessionFactory.close();
	}

	@Test
	public void getConnection() {
		SessionFactory sessionFactory = HibernateUtils.getConnectionFactory();
	}
}
